﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PetaPoco;

namespace QuickLifeHall.DAL.SystemBase
{
    public class Menu : BaseRepository<Entity.SystemBase.Menu>
    {
        public List<Entity.SystemBase.Menu> GetChildrenMenu(int parentId)
        {
            return database.Fetch<Entity.SystemBase.Menu>(Sql.Builder
                .Append("SELECT *, (SELECT COUNT(*) FROM [Menu] c WHERE c.ParentID=M.MenuID) AS ChildrenCount FROM [Menu] M Where ParentID=@0", parentId));
        }
    }
}